```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java异常处理机制详解 | 技术小馆</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.6;
        }
        .serif {
            font-family: 'Noto Serif SC', serif;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 30%;
            background-color: rgba(102, 126, 234, 0.2);
            z-index: -1;
            transition: all 0.3s ease;
        }
        .highlight:hover::after {
            height: 100%;
        }
        .drop-cap::first-letter {
            float: left;
            font-size: 3.5rem;
            line-height: 1;
            margin: 0.2em 0.15em 0 0;
            color: #667eea;
            font-weight: bold;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <header class="hero-gradient text-white py-20 px-4 md:py-28">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col items-center text-center">
                <span class="bg-white text-indigo-700 px-4 py-1 rounded-full text-xs font-semibold tracking-wide mb-4">JAVA 异常处理</span>
                <h1 class="serif text-4xl md:text-5xl font-bold leading-tight mb-6">
                    Java异常处理机制
                    <span class="highlight inline-block">深度解析</span>
                </h1>
                <p class="text-xl max-w-2xl opacity-90 mb-8">
                    <i class="fas fa-quote-left opacity-70 mr-2"></i>
                    探索Throwable的层次结构，掌握Java异常处理的最佳实践
                    <i class="fas fa-quote-right opacity-70 ml-2"></i>
                </p>
                <a href="#content" class="bg-white text-indigo-700 px-8 py-3 rounded-full font-medium hover:bg-gray-100 transition duration-300">
                    <i class="fas fa-arrow-down mr-2"></i>开始探索
                </a>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main id="content" class="container mx-auto max-w-6xl px-4 py-12">
        <!-- Intro Section -->
        <section class="mb-16">
            <div class="prose max-w-none mx-auto">
                <p class="drop-cap text-gray-700 mb-6 leading-relaxed text-lg">
                    在Java编程语言中，异常处理机制是构建健壮应用程序的核心组件之一。<code>Throwable</code>类作为所有错误和异常的基类，定义了处理异常所需的基本方法，为Java提供了一套完整的异常处理体系。
                </p>
                <div class="bg-blue-50 border-l-4 border-blue-500 p-4 my-6 rounded-r">
                    <div class="flex">
                        <div class="flex-shrink-0 text-blue-500">
                            <i class="fas fa-info-circle text-xl"></i>
                        </div>
                        <div class="ml-3">
                            <p class="text-blue-700">
                                异常处理不仅仅是捕获错误，更重要的是提供优雅的恢复路径和清晰的错误信息，以提升用户体验和系统稳定性。
                            </p>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization Section -->
        <section class="mb-16">
            <h2 class="serif text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-project-diagram text-indigo-500 mr-3"></i>
                Java异常层次结构可视化
            </h2>
            <div class="bg-white rounded-xl shadow-lg p-6">
                <div class="mermaid">
                    classDiagram
                        Throwable <|-- Error
                        Throwable <|-- Exception
                        Error <|-- OutOfMemoryError
                        Error <|-- StackOverflowError
                        Error <|-- VirtualMachineError
                        Exception <|-- RuntimeException
                        Exception <|-- CheckedException
                        RuntimeException <|-- NullPointerException
                        RuntimeException <|-- ArrayIndexOutOfBoundsException
                        RuntimeException <|-- IllegalArgumentException
                        RuntimeException <|-- ArithmeticException
                        CheckedException <|-- IOException
                        CheckedException <|-- SQLException
                        CheckedException <|-- ClassNotFoundException
                        CheckedException <|-- FileNotFoundException

                        class Throwable {
                            +getMessage()
                            +printStackTrace()
                            +getCause()
                        }
                </div>
            </div>
        </section>

        <!-- Throwable Section -->
        <section class="mb-16">
            <div class="flex flex-col md:flex-row gap-8">
                <div class="md:w-1/3">
                    <div class="bg-indigo-600 text-white p-6 rounded-xl h-full card-hover">
                        <div class="flex items-center mb-4">
                            <div class="bg-white text-indigo-600 rounded-full p-3 mr-4">
                                <i class="fas fa-exclamation-triangle text-xl"></i>
                            </div>
                            <h3 class="serif text-2xl font-bold">Throwable</h3>
                        </div>
                        <p class="text-indigo-100 mb-4">Java异常体系的根基，定义了所有错误和异常的基本行为。</p>
                        <ul class="space-y-2 text-indigo-100">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-indigo-300"></i>
                                <span>getMessage(): 获取异常信息</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-indigo-300"></i>
                                <span>printStackTrace(): 打印调用栈</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle mt-1 mr-2 text-indigo-300"></i>
                                <span>getCause(): 获取原始异常</span>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="md:w-2/3">
                    <div class="bg-white p-6 rounded-xl shadow-md h-full card-hover">
                        <h3 class="serif text-2xl font-bold text-gray-800 mb-4">Throwable类详解</h3>
                        <p class="text-gray-700 mb-4">
                            <code>Throwable</code>是Java语言中所有错误和异常的基类。只有作为此类（或其子类之一）实例的对象才能由Java虚拟机抛出，或者可以由Java的<code>throw</code>语句抛出。
                        </p>
                        <div class="bg-gray-50 p-4 rounded-lg mb-4">
                            <h4 class="font-semibold text-gray-800 mb-2">核心方法：</h4>
                            <ul class="list-disc pl-5 space-y-1 text-gray-700">
                                <li><code>String getMessage()</code>: 返回此throwable的详细消息字符串</li>
                                <li><code>void printStackTrace()</code>: 将此throwable及其追踪输出至标准错误流</li>
                                <li><code>Throwable getCause()</code>: 返回导致此throwable的原因</li>
                                <li><code>StackTraceElement[] getStackTrace()</code>: 提供对堆栈跟踪的编程访问</li>
                            </ul>
                        </div>
                        <p class="text-gray-700">
                            理解<code>Throwable</code>的这些基本方法对于有效诊断和调试Java应用程序中的问题至关重要。在实际开发中，我们通常不会直接处理<code>Throwable</code>，而是处理其更具体的子类<code>Error</code>或<code>Exception</code>。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Error vs Exception Section -->
        <section class="mb-16">
            <h2 class="serif text-3xl font-bold mb-8 text-gray-800">
                <i class="fas fa-balance-scale text-indigo-500 mr-3"></i>
                Error与Exception对比
            </h2>
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Error Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-red-600 px-6 py-4">
                        <h3 class="serif text-2xl font-bold text-white flex items-center">
                            <i class="fas fa-times-circle mr-3"></i>
                            Error
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">
                            <code>Error</code>表示JVM内部错误或资源耗尽等严重问题，这些通常是应用程序无法处理的非正常情况。
                        </p>
                        <div class="bg-red-50 border-l-4 border-red-500 p-4 mb-4 rounded-r">
                            <p class="text-red-700 font-medium">
                                <i class="fas fa-exclamation-circle mr-2"></i>
                                最佳实践：通常不应该捕获Error，而应该让程序优雅终止
                            </p>
                        </div>
                        <h4 class="font-semibold text-gray-800 mb-2">常见子类：</h4>
                        <div class="space-y-3">
                            <div class="flex items-start">
                                <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                    <i class="fas fa-memory text-sm"></i>
                                </div>
                                <div>
                                    <h5 class="font-medium text-gray-800">OutOfMemoryError</h5>
                                    <p class="text-sm text-gray-600">当JVM无法分配内存时抛出，通常由于内存泄漏或堆空间设置过小</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                    <i class="fas fa-code-branch text-sm"></i>
                                </div>
                                <div>
                                    <h5 class="font-medium text-gray-800">StackOverflowError</h5>
                                    <p class="text-sm text-gray-600">当栈空间被耗尽时抛出，通常由于无限递归引起</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                    <i class="fas fa-server text-sm"></i>
                                </div>
                                <div>
                                    <h5 class="font-medium text-gray-800">VirtualMachineError</h5>
                                    <p class="text-sm text-gray-600">表示虚拟机的内部错误，如无法启动虚拟机等</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Exception Card -->
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover">
                    <div class="bg-blue-600 px-6 py-4">
                        <h3 class="serif text-2xl font-bold text-white flex items-center">
                            <i class="fas fa-exclamation-triangle mr-3"></i>
                            Exception
                        </h3>
                    </div>
                    <div class="p-6">
                        <p class="text-gray-700 mb-4">
                            <code>Exception</code>表示程序可以处理的异常情况，它们可以被捕获和处理，通常用于表示程序的逻辑错误或其他可恢复的情况。
                        </p>
                        <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-4 rounded-r">
                            <p class="text-blue-700 font-medium">
                                <i class="fas fa-lightbulb mr-2"></i>
                                最佳实践：应该合理捕获并处理异常，提供有意义的错误信息
                            </p>
                        </div>
                        <div class="grid md:grid-cols-2 gap-4">
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2">RuntimeException</h4>
                                <ul class="list-disc pl-5 space-y-1 text-gray-700 text-sm">
                                    <li>NullPointerException</li>
                                    <li>ArrayIndexOutOfBoundsException</li>
                                    <li>IllegalArgumentException</li>
                                    <li>ArithmeticException</li>
                                </ul>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800 mb-2">CheckedException</h4>
                                <ul class="list-disc pl-5 space-y-1 text-gray-700 text-sm">
                                    <li>IOException</li>
                                    <li>SQLException</li>
                                    <li>ClassNotFoundException</li>
                                    <li>FileNotFoundException</li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Exception Types Section -->
        <section class="mb-16">
            <h2 class="serif text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-sitemap text-indigo-500 mr-3"></i>
                异常类型详解
            </h2>
            <div class="bg-white rounded-xl shadow-lg overflow-hidden">
                <div class="border-b border-gray-200">
                    <nav class="flex -mb-px">
                        <button class="tab-btn active px-6 py-4 text-sm font-medium text-center border-b-2 border-indigo-500 text-indigo-600">
                            RuntimeException
                        </button>
                        <button class="tab-btn px-6 py-4 text-sm font-medium text-center border-b-2 border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300">
                            Checked Exception
                        </button>
                    </nav>
                </div>
                <div class="p-6">
                    <div class="tab-content active">
                        <h3 class="serif text-2xl font-bold text-gray-800 mb-4">RuntimeException</h3>
                        <p class="text-gray-700 mb-6">
                            <code>RuntimeException</code>及其子类是Java中的"不受检查异常"(unchecked exceptions)。这些异常通常表示编程错误，如逻辑错误或不正确的API使用方式。编译器不要求方法捕获或声明这些异常。
                        </p>
                        
                        <div class="grid md:grid-cols-2 gap-6">
                            <!-- NullPointerException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-bug"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">NullPointerException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    当应用程序试图在需要对象的地方使用null时抛出，如调用null对象的方法或访问其字段。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p class="text-red-600">// 错误示例</p>
                                    <p>String str = null;</p>
                                    <p>System.out.println(str.length()); // 抛出NullPointerException</p>
                                </div>
                            </div>
                            
                            <!-- ArrayIndexOutOfBoundsException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-table"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">ArrayIndexOutOfBoundsException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    用非法索引访问数组时抛出的异常。索引为负或大于等于数组大小时发生。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p class="text-red-600">// 错误示例</p>
                                    <p>int[] arr = {1, 2, 3};</p>
                                    <p>System.out.println(arr[3]); // 抛出ArrayIndexOutOfBoundsException</p>
                                </div>
                            </div>
                            
                            <!-- IllegalArgumentException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-exclamation"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">IllegalArgumentException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    向方法传递了一个不合法或不正确的参数时抛出。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p class="text-red-600">// 错误示例</p>
                                    <p>public void setAge(int age) {</p>
                                    <p class="pl-4">if (age < 0) {</p>
                                    <p class="pl-8">throw new IllegalArgumentException("年龄不能为负数");</p>
                                    <p class="pl-4">}</p>
                                    <p>}</p>
                                </div>
                            </div>
                            
                            <!-- ArithmeticException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-red-100 text-red-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-divide"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">ArithmeticException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    当出现异常的算术条件时抛出，如整数除以零。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p class="text-red-600">// 错误示例</p>
                                    <p>int result = 10 / 0; // 抛出ArithmeticException</p>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <div class="tab-content hidden">
                        <h3 class="serif text-2xl font-bold text-gray-800 mb-4">Checked Exception</h3>
                        <p class="text-gray-700 mb-6">
                            <code>CheckedException</code>是必须在方法签名中声明或在try-catch块中处理的异常。这些异常通常表示程序外部的问题，如I/O错误或数据库连接问题，程序应该能够预期并处理这些情况。
                        </p>
                        
                        <div class="grid md:grid-cols-2 gap-6">
                            <!-- IOException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-blue-100 text-blue-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-file-alt"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">IOException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    表示输入输出操作失败的异常，如文件读写失败、流操作失败等。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p>try {</p>
                                    <p class="pl-4">FileReader file = new FileReader("nonexistent.txt");</p>
                                    <p>} catch (IOException e) {</p>
                                    <p class="pl-4">System.out.println("文件读取失败: " + e.getMessage());</p>
                                    <p>}</p>
                                </div>
                            </div>
                            
                            <!-- SQLException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-blue-100 text-blue-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-database"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">SQLException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    提供有关数据库访问错误或其他错误信息的异常。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p>try {</p>
                                    <p class="pl-4">Connection conn = DriverManager.getConnection(url);</p>
                                    <p class="pl-4">Statement stmt = conn.createStatement();</p>
                                    <p class="pl-4">ResultSet rs = stmt.executeQuery("SELECT * FROM table");</p>
                                    <p>} catch (SQLException e) {</p>
                                    <p class="pl-4">System.out.println("SQL错误: " + e.getMessage());</p>
                                    <p>}</p>
                                </div>
                            </div>
                            
                            <!-- ClassNotFoundException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-blue-100 text-blue-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-cube"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">ClassNotFoundException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    当应用程序试图通过名称加载类但在类路径中找不到时抛出。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p>try {</p>
                                    <p class="pl-4">Class.forName("com.example.NonexistentClass");</p>
                                    <p>} catch (ClassNotFoundException e) {</p>
                                    <p class="pl-4">System.out.println("类未找到: " + e.getMessage());</p>
                                    <p>}</p>
                                </div>
                            </div>
                            
                            <!-- FileNotFoundException -->
                            <div class="bg-gray-50 p-4 rounded-lg border border-gray-200">
                                <div class="flex items-center mb-2">
                                    <div class="bg-blue-100 text-blue-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-file-exclamation"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">FileNotFoundException</h4>
                                </div>
                                <p class="text-gray-700 text-sm mb-2">
                                    当试图打开由指定路径名表示的文件失败时抛出。
                                </p>
                                <div class="bg-white p-3 rounded text-xs font-mono overflow-x-auto">
                                    <p>try {</p>
                                    <p class="pl-4">FileInputStream fis = new FileInputStream("nonexistent.txt");</p>
                                    <p>} catch (FileNotFoundException e) {</p>
                                    <p class="pl-4">System.out.println("文件未找到: " + e.getMessage());</p>
                                    <p>}</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Best Practices Section -->
        <section class="mb-16">
            <h2 class="serif text-3xl font-bold mb-6 text-gray-800">
                <i class="fas fa-star text-indigo-500 mr-3"></i>
                异常处理最佳实践
            </h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <h3 class="serif text-2xl font-bold text-gray-800 mb-4">Do's</h3>
                    <ul class="space-y-4">
                        <li class="flex items-start">
                            <div class="bg-green-100 text-green-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-check"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">使用具体的异常类型</h4>
                                <p class="text-gray-600 text-sm">捕获最具体的异常类型，而不是通用的Exception或Throwable</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-green-100 text-green-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-check"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">提供有意义的错误信息</h4>
                                <p class="text-gray-600 text-sm">在抛出异常时，包含足够的上下文信息以便于调试</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-green-100 text-green-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-check"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">清理资源</h4>
                                <p class="text-gray-600 text-sm">在finally块或try-with-resources中确保资源被正确释放</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-green-100 text-green-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-check"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">记录异常</h4>
                                <p class="text-gray-600 text-sm">使用日志系统记录异常，包括堆栈跟踪和上下文信息</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="bg-white rounded-xl shadow-md p-6 card-hover">
                    <h3 class="serif text-2xl font-bold text-gray-800 mb-4">Don'ts</h3>
                    <ul class="space-y-4">
                        <li class="flex items-start">
                            <div class="bg-red-100 text-red-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-times"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">吞掉异常</h4>
                                <p class="text-gray-600 text-sm">不要捕获异常后什么都不做，至少要记录日志</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-red-100 text-red-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-times"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">过度使用检查异常</h4>
                                <p class="text-gray-600 text-sm">只在调用者能够合理处理异常时使用检查异常</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-red-100 text-red-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-times"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">暴露实现细节</h4>
                                <p class="text-gray-600 text-sm">不要向最终用户显示原始异常信息，可能包含敏感数据</p>
                            </div>
                        </li>
                        <li class="flex items-start">
                            <div class="bg-red-100 text-red-600 rounded-full p-2 mr-4 flex-shrink-0">
                                <i class="fas fa-times"></i>
                            </div>
                            <div>
                                <h4 class="font-semibold text-gray-800">滥用异常控制流程</h4>
                                <p class="text-gray-600 text-sm">不要使用异常来处理正常的程序逻辑流程</p>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Summary Section -->
        <section class="mb-16">
            <div class="bg-indigo-50 rounded-xl p-8">
                <h2 class="serif text-3xl font-bold mb-6 text-indigo-800">
                    <i class="fas fa-lightbulb text-indigo-600 mr-3"></i>
                    核心要点总结
                </h2>
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-indigo-600 text-2xl mb-3">
                            <i class="fas fa-layer-group"></i>
                        </div>
                        <h3 class="font-bold text-gray-800 mb-2">层次结构</h3>
                        <p class="text-gray-700 text-sm">
                            Java异常体系以Throwable为根，分为Error和Exception两大分支，分别处理不可恢复的错误和可处理的异常。
                        </p>
                    </div>
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-indigo-600 text-2xl mb-3">
                            <i class="fas fa-universal-access"></i>
                        </div>
                        <h3 class="font-bold text-gray-800 mb-2">异常分类</h3>
                        <p class="text-gray-700 text-sm">
                            Exception分为RuntimeException(运行时异常)和CheckedException(检查异常)，前者通常不强制捕获，后者必须处理。
                        </p>
                    </div>
                    <div class="bg-white p-5 rounded-lg shadow-sm">
                        <div class="text-indigo-600 text-2xl mb-3">
                            <i class="fas fa-hands-helping"></i>
                        </div>
                        <h3 class="font-bold text-gray-800 mb-2">处理原则</h3>
                        <p class="text-gray-700 text-sm">
                            合理使用try-catch-finally块，区分可恢复和不可恢复错误，提供有意义的错误信息和恢复路径。
                        </p>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12 px-4">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col items-center">
                <h3 class="text-xl font-medium text-white mb-2">技术小馆</h3>
                <a href="http://www.yuque.com/jtostring" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
                    <i class="fas fa-external-link-alt mr-1"></i>
                    http://www.yuque.com/jtostring
                </a>
                <div class="mt-6 flex space-x-4">
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-github text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-twitter text-xl"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white transition duration-300">
                        <i class="fab fa-linkedin text-xl"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });

        // Tab functionality
        document.addEventListener('DOMContentLoaded', function() {
            const tabBtns = document.querySelectorAll('.tab-btn');
            const tabContents = document.querySelectorAll('.tab-content');
            
            tabBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    // Remove active class from all buttons and contents
                    tabBtns.forEach(b => b.classList.remove('active'));
                    tabContents.forEach(c => c.classList.add('hidden'));
                    
                    // Add active class to clicked button
                    this.classList.add('active');
                    
                    // Show corresponding content
                    const tabId = this.textContent.trim().toLowerCase().replace(' ', '-');
                    document.querySelector(`.tab-content.${tabId}`)?.classList.remove('hidden');
                });
            });
        });
    </script>
</body>
</html>
```